{% extends 'system_template/public/base_main.html' %}
{% block cite %}API 免登陆接口 / 前台接口授权{% endblock %}
{% block content %}
    <form class="layui-form" id="form1">
    <blockquote class="layui-elem-quote site-text">
      API 免登陆接口 配置
    </blockquote>
        {% for foo in form %}
            <div class="layui-form-item">
                <label class="layui-form-label">{{ foo.label }}</label>
                <div class="layui-input-inline">
                    {{ foo }}
                    <div class="layui-form-mid">
                        {% if foo.name=='status' %}
                            开启 [<span style="color: red"> 有效</span>  ]
                        {% elif foo.name=='impower_code' %}
                            授权码由系统自动生成 [ 点击生成即可 ] / <span style="color: red">点击复制</span>
                        {% endif %}
                    </div>
                </div>
            </div>
        {% endfor %}
        <div class="layui-form-item">
            <div class="layui-input-block">
                <a class="layui-btn" onclick="submit_post(location.href,'#form1')">生成授权</a>
            </div>
        </div>
    </form>
    <form class="layui-form" id="form2">
    <blockquote class="layui-elem-quote site-text">
      前台数据接口 配置
    </blockquote>
        {% for foo in form2 %}
            <div class="layui-form-item">
                <label class="layui-form-label">{{ foo.label }}</label>
                <div class="layui-input-inline">
                    {{ foo }}
                    <div class="layui-form-mid">
                        {% if foo.name=='status' %}
                            开启 [<span style="color: red"> 有效</span>  ]
                        {% elif foo.name=='public_key' %}
                            请输入自定义授权 KEY
                        {% elif foo.name=='private_code' %}
                            授权码由系统加密自动生成 [ 用于前台数据接口验证 ]  / <span style="color: red">点击复制</span>
                            {% elif foo.name=='public_pem' %}
                            用于前台数据加密 / <span style="color: red">点击复制</span>
                        {% endif %}
                    </div>
                </div>
            </div>
        {% endfor %}
        <div class="layui-form-item">
            <div class="layui-input-block">
                <a class="layui-btn" onclick="submit_post(location.href,'#form2')">保存配置</a>
            </div>
        </div>
        <input type="text" hidden="hidden" name="verify" value="true">
    </form>
{% endblock %}
{% block footer %}
<script>
    function copyText(elem) {
      document.getElementById(elem).select();
      document.execCommand("copy");
      layer.msg('复制成功！即可粘贴')
    }
</script>
{% endblock %}